# By Christoph - https://cmake.org/pipermail/cmake/2012-June/050674.html
MACRO(HEADER_DIRECTORIES return_list curdir)
    FILE(GLOB_RECURSE new_list ${curdir}/*.h ${curdir}/*.hpp)
    SET(dir_list "")
    FOREACH(file_path ${new_list})
        GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
        SET(dir_list ${dir_list} ${dir_path})
    ENDFOREACH()
    LIST(REMOVE_DUPLICATES dir_list)
    SET(${return_list} ${dir_list})
ENDMACRO()
